import { Component } from "react"
import './index.css'
class MyItem extends Component {
    checkChange = (id) => {
        return (event) => {
            console.log(id, event.target.checked)
            this.props.checkedChange(id, event.target.checked)
        }
    }
    render() {
        const { name, checked, id } = this.props
        return (
            <div className="body-check-item">
                <input defaultChecked={checked} onChange={this.checkChange(id)} type="checkbox" className="item"></input>
                <label className="label">{name}，随机字符串{id}</label>
                <span className="del">删除</span>
            </div>
        )
    }
}

export default MyItem